package cn.btks.resultintegration.rule.controller;

import cn.btks.commonserver.result.ResultState;
import cn.btks.commonserver.result.StateInfo;
import cn.btks.resultintegration.rule.pojo.Kfqsxb;
import cn.btks.resultintegration.rule.service.KfqsxbService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author lijun
 * @Date 2021/2/19 11:04
 */
@RestController
@RequestMapping("api/v1.0/resultIntegration/rule")
@Api(tags = "规则模块")
@Validated
public class KfqsxbController {

    @Autowired
    KfqsxbService kfqsxbService;

    @GetMapping("/kfqsxb/findAllByGmjjdm")
    @ApiOperation("《开发区属性表》根据国民经济代码查询")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "gmjjdm", value = "国民经济代码", required = true, dataType = "string"),
            @ApiImplicitParam(paramType = "header", name = "token", value = "token密匙", required = true, dataType = "string"),
    })
    public ResultState findAllByGmjjdm(String gmjjdm) {
        List<Kfqsxb> list = kfqsxbService.findAllByGMjjdm(gmjjdm);
        return list != null ? new ResultState(StateInfo.FIND_OK.getCode(),StateInfo.FIND_OK.getMsg(), list) :
                new ResultState(StateInfo.FIND_NULL.getCode(),StateInfo.FIND_NULL.getMsg());
    }
}
